cmake_minimum_required(VERSION 3.10)

#project(iec04)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O0 -fPIC")


aux_source_directory(./src SRC)

#include_directories
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../common/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../logger/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../datacenter/include)


#library_directories
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib/aarch32)

add_library(iec104 SHARED ${SRC}) # 生成动态库或共享库
SET_TARGET_PROPERTIES(iec104 PROPERTIES VERSION 1.0.0 SOVERSION 1)

TARGET_LINK_LIBRARIES(iec104 liblib60870.so)

install(TARGETS iec104 
        LIBRARY DESTINATION ${CMAKE_LIBRARY_PATH})


add_custom_command(TARGET  iec104
        POST_BUILD
        COMMAND echo "iec104 builded finished."
        COMMAND ${CMAKE_STRIP} "$<TARGET_FILE:iec104>"
       )